
import 'dart:convert';
import 'package:jubobao/home/JuBoHomeModel.dart';
import 'package:jubobao/home/JuBoNewModel.dart';
import 'package:jubobao/services/JuBoConfig.dart';
import 'dart:io';

import 'package:jubobao/services/JuBoHttpRequest.dart';

class JuBoHomeRequest {

   static Future<JuBoHomeModel> homeConfig() async{
    final result = await JuBoHttpNativeRequest.nativeRequest(
        'ServiceInterface/Home/HomePageService.asmx/HomeConfig');
    return JuBoHomeModel.fromJson(result);
  }

  static Future<List<JuBoNewModel>> newsConfig(int pageSize) async{
        final result = await JuBoHttpRequest.request('atapi/atjubonews/',
                                                      params: {
                                                        'pageSize' : pageSize
                                                      },
                                                     );
        print(result);
        List<JuBoNewModel> results = [];
        final list =  result['ReList'];
        for (var json in list){
           results.add(JuBoNewModel.fromJson(json));
        }
        return results;
    }

}
